<?php

/**
 * HalalmenuProfile filter form base class.
 *
 * @package    halalmenu_dev
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseHalalmenuProfileFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'sf_guard_user_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser'), 'add_empty' => true)),
      'zipcode'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'city'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'birthdaydate'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'genre'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'is_newsletter'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'is_offer_promotion' => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'sf_guard_user_id'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('sfGuardUser'), 'column' => 'id')),
      'zipcode'            => new sfValidatorPass(array('required' => false)),
      'city'               => new sfValidatorPass(array('required' => false)),
      'birthdaydate'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'genre'              => new sfValidatorPass(array('required' => false)),
      'is_newsletter'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_offer_promotion' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('halalmenu_profile_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'HalalmenuProfile';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'sf_guard_user_id'   => 'ForeignKey',
      'zipcode'            => 'Text',
      'city'               => 'Text',
      'birthdaydate'       => 'Date',
      'genre'              => 'Text',
      'is_newsletter'      => 'Number',
      'is_offer_promotion' => 'Number',
    );
  }
}
